package xyz.xtt.schedule.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;

@Data
@Accessors(chain = true)
@TableName("tbl_chain_transaction")
public class ChainTransactionEntity implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    // 交易hash
    private String hash;
    // 发送地址
    @TableField("`from`")
    private String from;
    // 接收地址
    @TableField("`to`")
    private String to;
    // 区块高度
    private String blockNumber;
    // 上链时间戳
    private int blockTimestamp;
    // 手续费
    private String gasUsed;
    // 合约执行结果（0表示失败，1表示成功）
    private String status;
    // 错误信息
    private String errorMsg;
    // 业务类型（mint、transfer、approval、burn等）
    @TableField("`type`")
    private String type;

    public ChainTransactionEntity(String hash, String from, String to, String blockNumber, int blockTimestamp, String gasUsed, String status, String errorMsg, String type) {
        this.hash = hash;
        this.from = from;
        this.to = to;
        this.blockNumber = blockNumber;
        this.blockTimestamp = blockTimestamp;
        this.gasUsed = gasUsed;
        this.status = status;
        this.errorMsg = errorMsg;
        this.type = type;
    }
}
